package com.cloudtec.yunzonedep.modules.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cloudtec.yunzonedep.modules.user.entity.SysUser;
import com.cloudtec.yunzonedep.modules.user.mapper.SysUserMapper;
import com.cloudtec.yunzonedep.modules.user.service.SysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author peter
 * @since 2019-12-13
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
    @Autowired
    private SysUserMapper userMapper;

    @Override
    @Cacheable(value="user-info",key="#id")
    public SysUser getUserByName(String username) {
        QueryWrapper qw= new QueryWrapper();
        qw.eq("username",username);
        return userMapper.selectOne(qw);
    }
}
